#include <iostream>
#include <cstring>

using namespace std;
const int N = 110 , M = 50010;
int dp[N][M];
int n , m;
int p[N] , c[N];
int main()
{
    cin >> n >> m;
    for(int i = 1;i <= n;i ++) cin >> p[i] >> c[i];

    memset(dp , 0x3f3f , sizeof dp);
    dp[0][0] = 0;
    for(int i = 1;i <= n;i ++)
    {
        for(int j = 0;j <= m;j ++)
        {
            dp[i][j] = min(dp[i-1][j] , dp[i][max(0 , j - p[i])] + c[i]);
        }
    }
    cout << dp[n][m] << endl;
    return 0; 
}